package com.geekca.d4;

import java.util.Arrays;
import java.util.Random;

public class RandomArray {
    public static void main(String[] args) {
        /**
         * 打乱顺序
         */
        int[] employeeNos = {22, 33, 35, 13, 88};
        //[I@3b07d329 对象地止
        System.out.println(Arrays.toString(employeeNos));
        Random ran = new Random();
        for (int i = 0; i < employeeNos.length; i++) {
//            Random ran = new Random();
            int randint = ran.nextInt(employeeNos.length);
            int tmp = 0;
            tmp = employeeNos[i];
            employeeNos[i] = employeeNos[randint];
            employeeNos[randint] = tmp;
        }

        System.out.println("打乱顺序后的数组为: "+ Arrays.toString(employeeNos));
//        for (int i = 0; i < employeeNos.length; i++) {
//            System.out.println(employeeNos[i]);
//        }

    }
}
